SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = format.parse(datetime); SimpleDateFormat df = new SimpleDateFormat("yyyy"); year = df.format(date);